<?php

namespace App\Wechat\Messages;

use EasyWeChat\Kernel\Contracts\EventHandlerInterface;
use App\Models\WxUser;
use App\Models\PriDeviceInfo;
use EasyWeChat\Kernel\Messages\News;
use EasyWeChat\Kernel\Messages\NewsItem;
use EasyWeChat\Kernel\Messages\Article;
use EasyWeChat\Kernel\Messages\Text;
/**
 * Description of Event
 *
 * @author Administrator
 */
class EventMessage implements EventHandlerInterface {

    public function handle($payload = null) {
          $app = app('wechat.official_account');
//        $event = $payload['Event'];
//        $eventId = $payload['EventKey'];
//        $openId = $payload['FromUserName'];
//        $info = PriDeviceInfo::find($eventId);
////        switch ($event) {
////            case 'SCAN':
////                $this->handleScan($openId, $eventId);
////                break;
////            default:
////                break;
////        }
//
//        $items = [
//            new NewsItem([
//                'title'       => '查看设备',
//                'description' => $info->pdi_name,
//                'url'         => 'http://www.baidu.com',
//                'image'       => '',
//                // ...
//            ])
//    ];
//    $news = new News($items);
    return '查看设备';
    }

    //设备二维码
    protected function handleScan($openId, $eventId) {
        
    }
}
